Repository navigation
Redesign the resource details attributes and add a relationships tab - #1330
Merged
Merged
Conversation
✅ Deploy Preview for commercelayer-app-elements ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
commit: |
…s tab
The Attributes tab is a single flat list, led by id and type, with a fixed
label column and right-aligned values.
`relationships: { names, onSelect }` adds a Relationships tab: one row per
relationship, telling a single relationship from a multiple one by its name.
Sideloaded has-one relationships are read from the resource; any other is
fetched when its row is expanded, ten records per page. `onSelect` makes each
related record clickable, e.g. to open it in another details modal.
PaginationInfo is translated and uses `aria-disabled`, so its buttons keep
keyboard focus while a page loads.
pfferrari
force-pushed
the
feat/773-new-resources
branch
from
November 19, 2026 14:17
06820ab to
4343e1e
Compare
pfferrari
force-pushed
the
feat/773-new-resources
branch
6 times, most recently
from
November 19, 2026 17:33
987b47b to
7499fd6
Compare
pfferrari
force-pushed
the
feat/773-new-resources
branch
from
November 19, 2026 17:42
7499fd6 to
08ed419
Compare
gciotola
approved these changes
Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to commercelayer/issues-app#773
What I did
The resource details (
ResourceDetailsContentanduseResourceDetailsModal) get a redesigned Attributes tab and an optional Relationships tab.<ResourceDetailsContent resource={order} + relationships={{ + names: ["market", "line_items", "available_payment_methods"], + onSelect: ({ type, id }) => openDetails(type, id), + }} />Tab row:
ResourceDetailsContenttakes three optional props for a container with no padding of its own, such as a column next to a list:tabsSize:regular(default) orsmall, passed toTabs(itssmallsize is from Add a small size to Tabs #1332, and now has a 20px line, as designed);edgeToEdge: the tab row runs from edge to edge, with the tabs and their content kept 24px from the sides. As in the design, the row is 52px tall with 16px above the tabs, and the content starts 12px under it, so the first line of every tab sits 24px under the row.fillHeight: fills the height of the container; the tab row stays in place and only the open panel scrolls, so its scrollbar starts under the row.useResourceDetailsModalalways uses all three, so the modal matches the details shown next to a list, and no longer accepts them.Modal height and scroll:
useResourceDetailsModalgives the modal a fixed height,clamp(480px, calc(70vh + 75px), 755px)(newheightprop ofModal), and only the open panel scrolls inside it, under the tab row, which stays in place. Switching tabs, opening an event or expanding a relationship no longer resizes the modal. The gradient strips that hinted at the old inner scroll are gone;panelHeightstill scrolls a panel on its own when set.Modal: corners are rounded to 8px (rounded) instead of 16px (rounded-md). This applies to every modal. A newheightprop fixes a modal's height (still capped by itsmin(90vh, 800px)maximum), andModal.Bodytakesflushto drop its padding for content that lays out its own.Events: the timeline matches the design: 14px day headings, 13px name and description, the time at 12px (the design has 11px, below our smallest text size), 72px rows, and a 2px black frame without shadow on the open event. This also applies to custom tabs built on
ResourceDetailsTimeline.Attributes: a single flat list, led by id and type, with a fixed label column and right-aligned values, in 12px monospace. The separate id/type card is gone. Object attributes keep their Json toggle.
Relationships: shown only when
relationshipsis passed, right after Attributes. One row per relationship, sorted by name. Each row says whether the relationship holds a single record or many, told from its name (plural, or ending inskus).PaginationInfoand the total under the list. A row reopens on the page it was left on.onSelect, each related record is a button that hands back itstypeandid.A11y: each row controls its panel, which is a section labelled by the row. The focus ring is drawn inside the rows and records, so the scrolling panel and the card don't clip it. Loading and errors are announced, and decorative icons are hidden.
PaginationInfo: the range and button labels are translated (common.pagination_range,common.previous_page,common.next_page). Its buttons usearia-disabledinstead ofdisabled, so they keep keyboard focus while a page loads or on the last page. This applies to every paginated list, as do its buttons, now white so they no longer look disabled on a gray background. Atopprop sets the room above the pager: 16px in a relationship, 24px (default) elsewhere.Exports:
ResourceRelationshipsConfigtype.Storybook: new WithRelationships story, with mocked relationship endpoints.
Screenshots
From the Storybook of this branch (Resources/useResourceDetailsModal → WithRelationships).
Attributes: small tabs on a row running from edge to edge of the modal, 8px corners; a single list led by ID and Type, labels in a fixed column, values right-aligned, empty values as a muted dash.
Relationships: one row per relationship, telling a single relationship from a multiple one. Line items is expanded: fetched on expand, ten per page, with the total and the white pager 16px under the list.
Events: day heading, rows and the open event as designed; the modal keeps the same height as on the other tabs.
How to test
pnpm check,pnpm ts:checkandpnpm testpass.1-10 of 30and the pager. › shows the next ten; collapsing and reopening the row keeps the page.onSelectshows its type and id.Checklist